@microsoft/terraform-cdk-constructs 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +60999 -15780
- package/API.md +54947 -10610
- package/README.md +72 -36
- package/docs/monitoring-guide.md +206 -0
- package/docs/testing.md +84 -1
- package/lib/azure-actiongroup/index.d.ts +11 -0
- package/lib/azure-actiongroup/index.js +28 -0
- package/lib/azure-actiongroup/lib/action-group-schemas.d.ts +24 -0
- package/lib/azure-actiongroup/lib/action-group-schemas.js +201 -0
- package/lib/azure-actiongroup/lib/action-group.d.ts +312 -0
- package/lib/azure-actiongroup/lib/action-group.js +201 -0
- package/lib/azure-actiongroup/lib/index.d.ts +5 -0
- package/lib/azure-actiongroup/lib/index.js +22 -0
- package/lib/azure-actiongroup/test/action-group.integ.d.ts +9 -0
- package/lib/azure-actiongroup/test/action-group.integ.js +79 -0
- package/lib/azure-actiongroup/test/action-group.spec.d.ts +8 -0
- package/lib/azure-actiongroup/test/action-group.spec.js +602 -0
- package/lib/azure-activitylogalert/index.d.ts +11 -0
- package/lib/azure-activitylogalert/index.js +28 -0
- package/lib/azure-activitylogalert/lib/activity-log-alert-schemas.d.ts +24 -0
- package/lib/azure-activitylogalert/lib/activity-log-alert-schemas.js +182 -0
- package/lib/azure-activitylogalert/lib/activity-log-alert.d.ts +236 -0
- package/lib/azure-activitylogalert/lib/activity-log-alert.js +212 -0
- package/lib/azure-activitylogalert/lib/index.d.ts +5 -0
- package/lib/azure-activitylogalert/lib/index.js +22 -0
- package/lib/azure-activitylogalert/test/activity-log-alert.integ.d.ts +9 -0
- package/lib/azure-activitylogalert/test/activity-log-alert.integ.js +98 -0
- package/lib/azure-activitylogalert/test/activity-log-alert.spec.d.ts +9 -0
- package/lib/azure-activitylogalert/test/activity-log-alert.spec.js +1101 -0
- package/lib/azure-aks/index.d.ts +9 -0
- package/lib/azure-aks/index.js +28 -0
- package/lib/azure-aks/lib/aks-cluster-schemas.d.ts +505 -0
- package/lib/azure-aks/lib/aks-cluster-schemas.js +572 -0
- package/lib/azure-aks/lib/aks-cluster.d.ts +395 -0
- package/lib/azure-aks/lib/aks-cluster.js +489 -0
- package/lib/azure-aks/lib/index.d.ts +11 -0
- package/lib/azure-aks/lib/index.js +38 -0
- package/lib/azure-aks/test/aks-cluster.integ.d.ts +9 -0
- package/lib/azure-aks/test/aks-cluster.integ.js +260 -0
- package/lib/azure-aks/test/aks-cluster.spec.d.ts +8 -0
- package/lib/azure-aks/test/aks-cluster.spec.js +1396 -0
- package/lib/azure-diagnosticsettings/index.d.ts +7 -0
- package/lib/azure-diagnosticsettings/index.js +24 -0
- package/lib/azure-diagnosticsettings/lib/diagnostic-settings-schemas.d.ts +50 -0
- package/lib/azure-diagnosticsettings/lib/diagnostic-settings-schemas.js +207 -0
- package/lib/azure-diagnosticsettings/lib/diagnostic-settings.d.ts +193 -0
- package/lib/azure-diagnosticsettings/lib/diagnostic-settings.js +200 -0
- package/lib/azure-diagnosticsettings/lib/index.d.ts +8 -0
- package/lib/azure-diagnosticsettings/lib/index.js +25 -0
- package/lib/azure-diagnosticsettings/test/diagnostic-settings.spec.d.ts +8 -0
- package/lib/azure-diagnosticsettings/test/diagnostic-settings.spec.js +432 -0
- package/lib/azure-metricalert/index.d.ts +11 -0
- package/lib/azure-metricalert/index.js +28 -0
- package/lib/azure-metricalert/lib/index.d.ts +5 -0
- package/lib/azure-metricalert/lib/index.js +22 -0
- package/lib/azure-metricalert/lib/metric-alert-schemas.d.ts +24 -0
- package/lib/azure-metricalert/lib/metric-alert-schemas.js +242 -0
- package/lib/azure-metricalert/lib/metric-alert.d.ts +344 -0
- package/lib/azure-metricalert/lib/metric-alert.js +252 -0
- package/lib/azure-metricalert/test/metric-alert.integ.d.ts +9 -0
- package/lib/azure-metricalert/test/metric-alert.integ.js +123 -0
- package/lib/azure-metricalert/test/metric-alert.spec.d.ts +9 -0
- package/lib/azure-metricalert/test/metric-alert.spec.js +1266 -0
- package/lib/azure-networkinterface/index.d.ts +4 -0
- package/lib/azure-networkinterface/index.js +21 -0
- package/lib/azure-networkinterface/lib/index.d.ts +6 -0
- package/lib/azure-networkinterface/lib/index.js +22 -0
- package/lib/azure-networkinterface/lib/network-interface-schemas.d.ts +32 -0
- package/lib/azure-networkinterface/lib/network-interface-schemas.js +222 -0
- package/lib/azure-networkinterface/lib/network-interface.d.ts +265 -0
- package/lib/azure-networkinterface/lib/network-interface.js +228 -0
- package/lib/azure-networkinterface/test/network-interface.integ.d.ts +9 -0
- package/lib/azure-networkinterface/test/network-interface.integ.js +102 -0
- package/lib/azure-networkinterface/test/network-interface.spec.d.ts +8 -0
- package/lib/azure-networkinterface/test/network-interface.spec.js +655 -0
- package/lib/azure-networksecuritygroup/index.d.ts +6 -0
- package/lib/azure-networksecuritygroup/index.js +23 -0
- package/lib/azure-networksecuritygroup/lib/index.d.ts +5 -0
- package/lib/azure-networksecuritygroup/lib/index.js +16 -0
- package/lib/azure-networksecuritygroup/lib/network-security-group-schemas.d.ts +32 -0
- package/lib/azure-networksecuritygroup/lib/network-security-group-schemas.js +198 -0
- package/lib/azure-networksecuritygroup/lib/network-security-group.d.ts +268 -0
- package/lib/azure-networksecuritygroup/lib/network-security-group.js +248 -0
- package/lib/azure-networksecuritygroup/test/network-security-group.integ.d.ts +9 -0
- package/lib/azure-networksecuritygroup/test/network-security-group.integ.js +151 -0
- package/lib/azure-networksecuritygroup/test/network-security-group.spec.d.ts +8 -0
- package/lib/azure-networksecuritygroup/test/network-security-group.spec.js +652 -0
- package/lib/azure-publicipaddress/index.d.ts +6 -0
- package/lib/azure-publicipaddress/index.js +23 -0
- package/lib/azure-publicipaddress/lib/index.d.ts +9 -0
- package/lib/azure-publicipaddress/lib/index.js +19 -0
- package/lib/azure-publicipaddress/lib/public-ip-address-schemas.d.ts +32 -0
- package/lib/azure-publicipaddress/lib/public-ip-address-schemas.js +227 -0
- package/lib/azure-publicipaddress/lib/public-ip-address.d.ts +256 -0
- package/lib/azure-publicipaddress/lib/public-ip-address.js +267 -0
- package/lib/azure-publicipaddress/test/public-ip-address.integ.d.ts +9 -0
- package/lib/azure-publicipaddress/test/public-ip-address.integ.js +75 -0
- package/lib/azure-publicipaddress/test/public-ip-address.spec.d.ts +15 -0
- package/lib/azure-publicipaddress/test/public-ip-address.spec.js +498 -0
- package/lib/azure-resourcegroup/lib/resource-group.js +1 -1
- package/lib/azure-resourcegroup/test/resource-group.integ.js +23 -11
- package/lib/azure-storageaccount/lib/storage-account-schemas.d.ts +98 -0
- package/lib/azure-storageaccount/lib/storage-account-schemas.js +1 -1
- package/lib/azure-storageaccount/lib/storage-account.d.ts +38 -1
- package/lib/azure-storageaccount/lib/storage-account.js +138 -2
- package/lib/azure-storageaccount/test/storage-account.integ.js +91 -12
- package/lib/azure-subnet/index.d.ts +4 -0
- package/lib/azure-subnet/index.js +21 -0
- package/lib/azure-subnet/lib/index.d.ts +5 -0
- package/lib/azure-subnet/lib/index.js +22 -0
- package/lib/azure-subnet/lib/subnet-schemas.d.ts +32 -0
- package/lib/azure-subnet/lib/subnet-schemas.js +237 -0
- package/lib/azure-subnet/lib/subnet.d.ts +285 -0
- package/lib/azure-subnet/lib/subnet.js +254 -0
- package/lib/azure-subnet/test/subnet.integ.d.ts +11 -0
- package/lib/azure-subnet/test/subnet.integ.js +80 -0
- package/lib/azure-subnet/test/subnet.spec.d.ts +8 -0
- package/lib/azure-subnet/test/subnet.spec.js +396 -0
- package/lib/azure-virtualmachine/index.d.ts +7 -0
- package/lib/azure-virtualmachine/index.js +24 -0
- package/lib/azure-virtualmachine/lib/index.d.ts +11 -0
- package/lib/azure-virtualmachine/lib/index.js +38 -0
- package/lib/azure-virtualmachine/lib/virtual-machine-schemas.d.ts +327 -0
- package/lib/azure-virtualmachine/lib/virtual-machine-schemas.js +544 -0
- package/lib/azure-virtualmachine/lib/virtual-machine.d.ts +377 -0
- package/lib/azure-virtualmachine/lib/virtual-machine.js +462 -0
- package/lib/azure-virtualmachine/test/virtual-machine.integ.d.ts +9 -0
- package/lib/azure-virtualmachine/test/virtual-machine.integ.js +220 -0
- package/lib/azure-virtualmachine/test/virtual-machine.spec.d.ts +9 -0
- package/lib/azure-virtualmachine/test/virtual-machine.spec.js +1032 -0
- package/lib/azure-virtualnetwork/index.d.ts +10 -0
- package/lib/azure-virtualnetwork/index.js +28 -0
- package/lib/azure-virtualnetwork/lib/index.d.ts +9 -0
- package/lib/azure-virtualnetwork/lib/index.js +22 -0
- package/lib/azure-virtualnetwork/lib/virtual-network-schemas.d.ts +32 -0
- package/lib/azure-virtualnetwork/lib/virtual-network-schemas.js +236 -0
- package/lib/azure-virtualnetwork/lib/virtual-network.d.ts +213 -0
- package/lib/azure-virtualnetwork/lib/virtual-network.js +245 -0
- package/lib/azure-virtualnetwork/test/virtual-network.integ.d.ts +9 -0
- package/lib/azure-virtualnetwork/test/virtual-network.integ.js +91 -0
- package/lib/azure-virtualnetwork/test/virtual-network.spec.d.ts +8 -0
- package/lib/azure-virtualnetwork/test/virtual-network.spec.js +398 -0
- package/lib/azure-vmss/index.d.ts +6 -0
- package/lib/azure-vmss/index.js +23 -0
- package/lib/azure-vmss/lib/index.d.ts +9 -0
- package/lib/azure-vmss/lib/index.js +39 -0
- package/lib/azure-vmss/lib/virtual-machine-scale-set.d.ts +258 -0
- package/lib/azure-vmss/lib/virtual-machine-scale-set.js +503 -0
- package/lib/azure-vmss/lib/vmss-schemas.d.ts +472 -0
- package/lib/azure-vmss/lib/vmss-schemas.js +444 -0
- package/lib/azure-vmss/test/virtual-machine-scale-set.integ.d.ts +15 -0
- package/lib/azure-vmss/test/virtual-machine-scale-set.integ.js +261 -0
- package/lib/azure-vmss/test/virtual-machine-scale-set.spec.d.ts +8 -0
- package/lib/azure-vmss/test/virtual-machine-scale-set.spec.js +997 -0
- package/lib/core-azure/lib/azapi/azapi-resource.d.ts +95 -27
- package/lib/core-azure/lib/azapi/azapi-resource.js +95 -58
- package/lib/core-azure/lib/azapi/providers-azapi/data-azapi-client-config/index.d.ts +33 -21
- package/lib/core-azure/lib/azapi/providers-azapi/data-azapi-client-config/index.js +69 -27
- package/lib/core-azure/lib/azapi/providers-azapi/data-azapi-resource/index.d.ts +134 -120
- package/lib/core-azure/lib/azapi/providers-azapi/data-azapi-resource/index.js +209 -59
- package/lib/core-azure/lib/azapi/providers-azapi/data-azapi-resource-action/index.d.ts +141 -128
- package/lib/core-azure/lib/azapi/providers-azapi/data-azapi-resource-action/index.js +183 -36
- package/lib/core-azure/lib/azapi/providers-azapi/data-azapi-resource-id/index.d.ts +55 -43
- package/lib/core-azure/lib/azapi/providers-azapi/data-azapi-resource-id/index.js +94 -26
- package/lib/core-azure/lib/azapi/providers-azapi/data-azapi-resource-list/index.d.ts +129 -116
- package/lib/core-azure/lib/azapi/providers-azapi/data-azapi-resource-list/index.js +155 -32
- package/lib/core-azure/lib/azapi/providers-azapi/data-plane-resource/index.d.ts +187 -174
- package/lib/core-azure/lib/azapi/providers-azapi/data-plane-resource/index.js +267 -48
- package/lib/core-azure/lib/azapi/providers-azapi/index.d.ts +10 -10
- package/lib/core-azure/lib/azapi/providers-azapi/index.js +1 -1
- package/lib/core-azure/lib/azapi/providers-azapi/lazy-index.d.ts +0 -0
- package/lib/core-azure/lib/azapi/providers-azapi/lazy-index.js +13 -0
- package/lib/core-azure/lib/azapi/providers-azapi/provider/index.d.ts +174 -162
- package/lib/core-azure/lib/azapi/providers-azapi/provider/index.js +274 -14
- package/lib/core-azure/lib/azapi/providers-azapi/resource/index.d.ts +239 -225
- package/lib/core-azure/lib/azapi/providers-azapi/resource/index.js +360 -76
- package/lib/core-azure/lib/azapi/providers-azapi/resource-action/index.d.ts +163 -150
- package/lib/core-azure/lib/azapi/providers-azapi/resource-action/index.js +221 -46
- package/lib/core-azure/lib/azapi/providers-azapi/update-resource/index.d.ts +162 -149
- package/lib/core-azure/lib/azapi/providers-azapi/update-resource/index.js +249 -50
- package/lib/core-azure/lib/azapi/schema-mapper/schema-mapper.js +4 -2
- package/lib/core-azure/lib/version-manager/api-version-manager.js +1 -1
- package/lib/core-azure/lib/version-manager/interfaces/version-interfaces.js +7 -7
- package/lib/index.d.ts +37 -0
- package/lib/index.js +40 -2
- package/lib/testing/index.d.ts +92 -2
- package/lib/testing/index.js +258 -18
- package/lib/testing/lib/cleanup.d.ts +229 -0
- package/lib/testing/lib/cleanup.js +331 -0
- package/lib/testing/lib/metadata.d.ts +151 -0
- package/lib/testing/lib/metadata.js +180 -0
- package/lib/testing/lib/naming.d.ts +96 -0
- package/lib/testing/lib/naming.js +336 -0
- package/node_modules/uuid/LICENSE.md +9 -0
- package/node_modules/uuid/README.md +510 -0
- package/node_modules/uuid/dist/cjs/index.d.ts +15 -0
- package/node_modules/uuid/dist/cjs/index.js +31 -0
- package/node_modules/uuid/dist/cjs/max.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/max.js +3 -0
- package/node_modules/uuid/dist/cjs/md5.d.ts +4 -0
- package/node_modules/uuid/dist/cjs/md5.js +13 -0
- package/node_modules/uuid/dist/cjs/native.d.ts +6 -0
- package/node_modules/uuid/dist/cjs/native.js +4 -0
- package/node_modules/uuid/dist/cjs/nil.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/nil.js +3 -0
- package/node_modules/uuid/dist/cjs/package.json +1 -0
- package/node_modules/uuid/dist/cjs/parse.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/parse.js +11 -0
- package/node_modules/uuid/dist/cjs/regex.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/regex.js +3 -0
- package/node_modules/uuid/dist/cjs/rng.d.ts +1 -0
- package/node_modules/uuid/dist/cjs/rng.js +13 -0
- package/node_modules/uuid/dist/cjs/sha1.d.ts +4 -0
- package/node_modules/uuid/dist/cjs/sha1.js +13 -0
- package/node_modules/uuid/dist/cjs/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/cjs/stringify.js +39 -0
- package/node_modules/uuid/dist/cjs/types.d.ts +21 -0
- package/node_modules/uuid/dist/cjs/types.js +2 -0
- package/node_modules/uuid/dist/cjs/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/cjs/uuid-bin.js +72 -0
- package/node_modules/uuid/dist/cjs/v1.d.ts +11 -0
- package/node_modules/uuid/dist/cjs/v1.js +87 -0
- package/node_modules/uuid/dist/cjs/v1ToV6.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/v1ToV6.js +13 -0
- package/node_modules/uuid/dist/cjs/v3.d.ts +9 -0
- package/node_modules/uuid/dist/cjs/v3.js +14 -0
- package/node_modules/uuid/dist/cjs/v35.d.ts +7 -0
- package/node_modules/uuid/dist/cjs/v35.js +41 -0
- package/node_modules/uuid/dist/cjs/v4.d.ts +4 -0
- package/node_modules/uuid/dist/cjs/v4.js +29 -0
- package/node_modules/uuid/dist/cjs/v5.d.ts +9 -0
- package/node_modules/uuid/dist/cjs/v5.js +14 -0
- package/node_modules/uuid/dist/cjs/v6.d.ts +4 -0
- package/node_modules/uuid/dist/cjs/v6.js +19 -0
- package/node_modules/uuid/dist/cjs/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/v6ToV1.js +13 -0
- package/node_modules/uuid/dist/cjs/v7.d.ts +9 -0
- package/node_modules/uuid/dist/cjs/v7.js +69 -0
- package/node_modules/uuid/dist/cjs/validate.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/validate.js +7 -0
- package/node_modules/uuid/dist/cjs/version.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/version.js +10 -0
- package/node_modules/uuid/dist/cjs-browser/index.d.ts +15 -0
- package/node_modules/uuid/dist/cjs-browser/index.js +31 -0
- package/node_modules/uuid/dist/cjs-browser/max.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/max.js +3 -0
- package/node_modules/uuid/dist/cjs-browser/md5.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/md5.js +137 -0
- package/node_modules/uuid/dist/cjs-browser/native.d.ts +4 -0
- package/node_modules/uuid/dist/cjs-browser/native.js +4 -0
- package/node_modules/uuid/dist/cjs-browser/nil.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/nil.js +3 -0
- package/node_modules/uuid/dist/cjs-browser/package.json +1 -0
- package/node_modules/uuid/dist/cjs-browser/parse.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/parse.js +11 -0
- package/node_modules/uuid/dist/cjs-browser/regex.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/regex.js +3 -0
- package/node_modules/uuid/dist/cjs-browser/rng.d.ts +1 -0
- package/node_modules/uuid/dist/cjs-browser/rng.js +14 -0
- package/node_modules/uuid/dist/cjs-browser/sha1.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/sha1.js +72 -0
- package/node_modules/uuid/dist/cjs-browser/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/cjs-browser/stringify.js +39 -0
- package/node_modules/uuid/dist/cjs-browser/types.d.ts +21 -0
- package/node_modules/uuid/dist/cjs-browser/types.js +2 -0
- package/node_modules/uuid/dist/cjs-browser/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/cjs-browser/uuid-bin.js +72 -0
- package/node_modules/uuid/dist/cjs-browser/v1.d.ts +11 -0
- package/node_modules/uuid/dist/cjs-browser/v1.js +87 -0
- package/node_modules/uuid/dist/cjs-browser/v1ToV6.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/v1ToV6.js +13 -0
- package/node_modules/uuid/dist/cjs-browser/v3.d.ts +9 -0
- package/node_modules/uuid/dist/cjs-browser/v3.js +14 -0
- package/node_modules/uuid/dist/cjs-browser/v35.d.ts +7 -0
- package/node_modules/uuid/dist/cjs-browser/v35.js +41 -0
- package/node_modules/uuid/dist/cjs-browser/v4.d.ts +4 -0
- package/node_modules/uuid/dist/cjs-browser/v4.js +29 -0
- package/node_modules/uuid/dist/cjs-browser/v5.d.ts +9 -0
- package/node_modules/uuid/dist/cjs-browser/v5.js +14 -0
- package/node_modules/uuid/dist/cjs-browser/v6.d.ts +4 -0
- package/node_modules/uuid/dist/cjs-browser/v6.js +19 -0
- package/node_modules/uuid/dist/cjs-browser/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/v6ToV1.js +13 -0
- package/node_modules/uuid/dist/cjs-browser/v7.d.ts +9 -0
- package/node_modules/uuid/dist/cjs-browser/v7.js +69 -0
- package/node_modules/uuid/dist/cjs-browser/validate.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/validate.js +7 -0
- package/node_modules/uuid/dist/cjs-browser/version.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/version.js +10 -0
- package/node_modules/uuid/dist/esm/bin/uuid +2 -0
- package/node_modules/uuid/dist/esm/index.d.ts +15 -0
- package/node_modules/uuid/dist/esm/index.js +14 -0
- package/node_modules/uuid/dist/esm/max.d.ts +2 -0
- package/node_modules/uuid/dist/esm/max.js +1 -0
- package/node_modules/uuid/dist/esm/md5.d.ts +4 -0
- package/node_modules/uuid/dist/esm/md5.js +11 -0
- package/node_modules/uuid/dist/esm/native.d.ts +6 -0
- package/node_modules/uuid/dist/esm/native.js +2 -0
- package/node_modules/uuid/dist/esm/nil.d.ts +2 -0
- package/node_modules/uuid/dist/esm/nil.js +1 -0
- package/node_modules/uuid/dist/esm/parse.d.ts +2 -0
- package/node_modules/uuid/dist/esm/parse.js +9 -0
- package/node_modules/uuid/dist/esm/regex.d.ts +2 -0
- package/node_modules/uuid/dist/esm/regex.js +1 -0
- package/node_modules/uuid/dist/esm/rng.d.ts +1 -0
- package/node_modules/uuid/dist/esm/rng.js +10 -0
- package/node_modules/uuid/dist/esm/sha1.d.ts +4 -0
- package/node_modules/uuid/dist/esm/sha1.js +11 -0
- package/node_modules/uuid/dist/esm/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/esm/stringify.js +35 -0
- package/node_modules/uuid/dist/esm/types.d.ts +21 -0
- package/node_modules/uuid/dist/esm/types.js +1 -0
- package/node_modules/uuid/dist/esm/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/esm/uuid-bin.js +70 -0
- package/node_modules/uuid/dist/esm/v1.d.ts +11 -0
- package/node_modules/uuid/dist/esm/v1.js +83 -0
- package/node_modules/uuid/dist/esm/v1ToV6.d.ts +2 -0
- package/node_modules/uuid/dist/esm/v1ToV6.js +10 -0
- package/node_modules/uuid/dist/esm/v3.d.ts +9 -0
- package/node_modules/uuid/dist/esm/v3.js +9 -0
- package/node_modules/uuid/dist/esm/v35.d.ts +7 -0
- package/node_modules/uuid/dist/esm/v35.js +36 -0
- package/node_modules/uuid/dist/esm/v4.d.ts +4 -0
- package/node_modules/uuid/dist/esm/v4.js +27 -0
- package/node_modules/uuid/dist/esm/v5.d.ts +9 -0
- package/node_modules/uuid/dist/esm/v5.js +9 -0
- package/node_modules/uuid/dist/esm/v6.d.ts +4 -0
- package/node_modules/uuid/dist/esm/v6.js +17 -0
- package/node_modules/uuid/dist/esm/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/esm/v6ToV1.js +10 -0
- package/node_modules/uuid/dist/esm/v7.d.ts +9 -0
- package/node_modules/uuid/dist/esm/v7.js +65 -0
- package/node_modules/uuid/dist/esm/validate.d.ts +2 -0
- package/node_modules/uuid/dist/esm/validate.js +5 -0
- package/node_modules/uuid/dist/esm/version.d.ts +2 -0
- package/node_modules/uuid/dist/esm/version.js +8 -0
- package/node_modules/uuid/dist/esm-browser/index.d.ts +15 -0
- package/node_modules/uuid/dist/esm-browser/index.js +14 -0
- package/node_modules/uuid/dist/esm-browser/max.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/max.js +1 -0
- package/node_modules/uuid/dist/esm-browser/md5.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/md5.js +135 -0
- package/node_modules/uuid/dist/esm-browser/native.d.ts +4 -0
- package/node_modules/uuid/dist/esm-browser/native.js +2 -0
- package/node_modules/uuid/dist/esm-browser/nil.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/nil.js +1 -0
- package/node_modules/uuid/dist/esm-browser/parse.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/parse.js +9 -0
- package/node_modules/uuid/dist/esm-browser/regex.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/regex.js +1 -0
- package/node_modules/uuid/dist/esm-browser/rng.d.ts +1 -0
- package/node_modules/uuid/dist/esm-browser/rng.js +11 -0
- package/node_modules/uuid/dist/esm-browser/sha1.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/sha1.js +70 -0
- package/node_modules/uuid/dist/esm-browser/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/esm-browser/stringify.js +35 -0
- package/node_modules/uuid/dist/esm-browser/types.d.ts +21 -0
- package/node_modules/uuid/dist/esm-browser/types.js +1 -0
- package/node_modules/uuid/dist/esm-browser/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/esm-browser/uuid-bin.js +70 -0
- package/node_modules/uuid/dist/esm-browser/v1.d.ts +11 -0
- package/node_modules/uuid/dist/esm-browser/v1.js +83 -0
- package/node_modules/uuid/dist/esm-browser/v1ToV6.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/v1ToV6.js +10 -0
- package/node_modules/uuid/dist/esm-browser/v3.d.ts +9 -0
- package/node_modules/uuid/dist/esm-browser/v3.js +9 -0
- package/node_modules/uuid/dist/esm-browser/v35.d.ts +7 -0
- package/node_modules/uuid/dist/esm-browser/v35.js +36 -0
- package/node_modules/uuid/dist/esm-browser/v4.d.ts +4 -0
- package/node_modules/uuid/dist/esm-browser/v4.js +27 -0
- package/node_modules/uuid/dist/esm-browser/v5.d.ts +9 -0
- package/node_modules/uuid/dist/esm-browser/v5.js +9 -0
- package/node_modules/uuid/dist/esm-browser/v6.d.ts +4 -0
- package/node_modules/uuid/dist/esm-browser/v6.js +17 -0
- package/node_modules/uuid/dist/esm-browser/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/v6ToV1.js +10 -0
- package/node_modules/uuid/dist/esm-browser/v7.d.ts +9 -0
- package/node_modules/uuid/dist/esm-browser/v7.js +65 -0
- package/node_modules/uuid/dist/esm-browser/validate.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/validate.js +5 -0
- package/node_modules/uuid/dist/esm-browser/version.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/version.js +8 -0
- package/node_modules/uuid/package.json +132 -0
- package/package.json +17 -12
- package/scripts/cleanup-test-resources.ts +369 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UUIDTypes } from './types.js';
|
|
2
|
+
export { DNS, URL } from './v35.js';
|
|
3
|
+
declare function v5(value: string | Uint8Array, namespace: UUIDTypes, buf?: undefined, offset?: number): string;
|
|
4
|
+
declare function v5<TBuf extends Uint8Array = Uint8Array>(value: string | Uint8Array, namespace: UUIDTypes, buf: TBuf, offset?: number): TBuf;
|
|
5
|
+
declare namespace v5 {
|
|
6
|
+
var DNS: string;
|
|
7
|
+
var URL: string;
|
|
8
|
+
}
|
|
9
|
+
export default v5;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.URL = exports.DNS = void 0;
|
|
4
|
+
const sha1_js_1 = require("./sha1.js");
|
|
5
|
+
const v35_js_1 = require("./v35.js");
|
|
6
|
+
var v35_js_2 = require("./v35.js");
|
|
7
|
+
Object.defineProperty(exports, "DNS", { enumerable: true, get: function () { return v35_js_2.DNS; } });
|
|
8
|
+
Object.defineProperty(exports, "URL", { enumerable: true, get: function () { return v35_js_2.URL; } });
|
|
9
|
+
function v5(value, namespace, buf, offset) {
|
|
10
|
+
return (0, v35_js_1.default)(0x50, sha1_js_1.default, value, namespace, buf, offset);
|
|
11
|
+
}
|
|
12
|
+
v5.DNS = v35_js_1.DNS;
|
|
13
|
+
v5.URL = v35_js_1.URL;
|
|
14
|
+
exports.default = v5;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Version6Options } from './types.js';
|
|
2
|
+
declare function v6(options?: Version6Options, buf?: undefined, offset?: number): string;
|
|
3
|
+
declare function v6<TBuf extends Uint8Array = Uint8Array>(options: Version6Options | undefined, buf: TBuf, offset?: number): TBuf;
|
|
4
|
+
export default v6;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const stringify_js_1 = require("./stringify.js");
|
|
4
|
+
const v1_js_1 = require("./v1.js");
|
|
5
|
+
const v1ToV6_js_1 = require("./v1ToV6.js");
|
|
6
|
+
function v6(options, buf, offset) {
|
|
7
|
+
options ??= {};
|
|
8
|
+
offset ??= 0;
|
|
9
|
+
let bytes = (0, v1_js_1.default)({ ...options, _v6: true }, new Uint8Array(16));
|
|
10
|
+
bytes = (0, v1ToV6_js_1.default)(bytes);
|
|
11
|
+
if (buf) {
|
|
12
|
+
for (let i = 0; i < 16; i++) {
|
|
13
|
+
buf[offset + i] = bytes[i];
|
|
14
|
+
}
|
|
15
|
+
return buf;
|
|
16
|
+
}
|
|
17
|
+
return (0, stringify_js_1.unsafeStringify)(bytes);
|
|
18
|
+
}
|
|
19
|
+
exports.default = v6;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const parse_js_1 = require("./parse.js");
|
|
4
|
+
const stringify_js_1 = require("./stringify.js");
|
|
5
|
+
function v6ToV1(uuid) {
|
|
6
|
+
const v6Bytes = typeof uuid === 'string' ? (0, parse_js_1.default)(uuid) : uuid;
|
|
7
|
+
const v1Bytes = _v6ToV1(v6Bytes);
|
|
8
|
+
return typeof uuid === 'string' ? (0, stringify_js_1.unsafeStringify)(v1Bytes) : v1Bytes;
|
|
9
|
+
}
|
|
10
|
+
exports.default = v6ToV1;
|
|
11
|
+
function _v6ToV1(v6Bytes) {
|
|
12
|
+
return Uint8Array.of(((v6Bytes[3] & 0x0f) << 4) | ((v6Bytes[4] >> 4) & 0x0f), ((v6Bytes[4] & 0x0f) << 4) | ((v6Bytes[5] & 0xf0) >> 4), ((v6Bytes[5] & 0x0f) << 4) | (v6Bytes[6] & 0x0f), v6Bytes[7], ((v6Bytes[1] & 0x0f) << 4) | ((v6Bytes[2] & 0xf0) >> 4), ((v6Bytes[2] & 0x0f) << 4) | ((v6Bytes[3] & 0xf0) >> 4), 0x10 | ((v6Bytes[0] & 0xf0) >> 4), ((v6Bytes[0] & 0x0f) << 4) | ((v6Bytes[1] & 0xf0) >> 4), v6Bytes[8], v6Bytes[9], v6Bytes[10], v6Bytes[11], v6Bytes[12], v6Bytes[13], v6Bytes[14], v6Bytes[15]);
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Version7Options } from './types.js';
|
|
2
|
+
type V7State = {
|
|
3
|
+
msecs?: number;
|
|
4
|
+
seq?: number;
|
|
5
|
+
};
|
|
6
|
+
declare function v7(options?: Version7Options, buf?: undefined, offset?: number): string;
|
|
7
|
+
declare function v7<TBuf extends Uint8Array = Uint8Array>(options: Version7Options | undefined, buf: TBuf, offset?: number): TBuf;
|
|
8
|
+
export declare function updateV7State(state: V7State, now: number, rnds: Uint8Array): V7State;
|
|
9
|
+
export default v7;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateV7State = void 0;
|
|
4
|
+
const rng_js_1 = require("./rng.js");
|
|
5
|
+
const stringify_js_1 = require("./stringify.js");
|
|
6
|
+
const _state = {};
|
|
7
|
+
function v7(options, buf, offset) {
|
|
8
|
+
let bytes;
|
|
9
|
+
if (options) {
|
|
10
|
+
bytes = v7Bytes(options.random ?? options.rng?.() ?? (0, rng_js_1.default)(), options.msecs, options.seq, buf, offset);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
const now = Date.now();
|
|
14
|
+
const rnds = (0, rng_js_1.default)();
|
|
15
|
+
updateV7State(_state, now, rnds);
|
|
16
|
+
bytes = v7Bytes(rnds, _state.msecs, _state.seq, buf, offset);
|
|
17
|
+
}
|
|
18
|
+
return buf ?? (0, stringify_js_1.unsafeStringify)(bytes);
|
|
19
|
+
}
|
|
20
|
+
function updateV7State(state, now, rnds) {
|
|
21
|
+
state.msecs ??= -Infinity;
|
|
22
|
+
state.seq ??= 0;
|
|
23
|
+
if (now > state.msecs) {
|
|
24
|
+
state.seq = (rnds[6] << 23) | (rnds[7] << 16) | (rnds[8] << 8) | rnds[9];
|
|
25
|
+
state.msecs = now;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
state.seq = (state.seq + 1) | 0;
|
|
29
|
+
if (state.seq === 0) {
|
|
30
|
+
state.msecs++;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return state;
|
|
34
|
+
}
|
|
35
|
+
exports.updateV7State = updateV7State;
|
|
36
|
+
function v7Bytes(rnds, msecs, seq, buf, offset = 0) {
|
|
37
|
+
if (rnds.length < 16) {
|
|
38
|
+
throw new Error('Random bytes length must be >= 16');
|
|
39
|
+
}
|
|
40
|
+
if (!buf) {
|
|
41
|
+
buf = new Uint8Array(16);
|
|
42
|
+
offset = 0;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
if (offset < 0 || offset + 16 > buf.length) {
|
|
46
|
+
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
msecs ??= Date.now();
|
|
50
|
+
seq ??= ((rnds[6] * 0x7f) << 24) | (rnds[7] << 16) | (rnds[8] << 8) | rnds[9];
|
|
51
|
+
buf[offset++] = (msecs / 0x10000000000) & 0xff;
|
|
52
|
+
buf[offset++] = (msecs / 0x100000000) & 0xff;
|
|
53
|
+
buf[offset++] = (msecs / 0x1000000) & 0xff;
|
|
54
|
+
buf[offset++] = (msecs / 0x10000) & 0xff;
|
|
55
|
+
buf[offset++] = (msecs / 0x100) & 0xff;
|
|
56
|
+
buf[offset++] = msecs & 0xff;
|
|
57
|
+
buf[offset++] = 0x70 | ((seq >>> 28) & 0x0f);
|
|
58
|
+
buf[offset++] = (seq >>> 20) & 0xff;
|
|
59
|
+
buf[offset++] = 0x80 | ((seq >>> 14) & 0x3f);
|
|
60
|
+
buf[offset++] = (seq >>> 6) & 0xff;
|
|
61
|
+
buf[offset++] = ((seq << 2) & 0xff) | (rnds[10] & 0x03);
|
|
62
|
+
buf[offset++] = rnds[11];
|
|
63
|
+
buf[offset++] = rnds[12];
|
|
64
|
+
buf[offset++] = rnds[13];
|
|
65
|
+
buf[offset++] = rnds[14];
|
|
66
|
+
buf[offset++] = rnds[15];
|
|
67
|
+
return buf;
|
|
68
|
+
}
|
|
69
|
+
exports.default = v7;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const validate_js_1 = require("./validate.js");
|
|
4
|
+
function version(uuid) {
|
|
5
|
+
if (!(0, validate_js_1.default)(uuid)) {
|
|
6
|
+
throw TypeError('Invalid UUID');
|
|
7
|
+
}
|
|
8
|
+
return parseInt(uuid.slice(14, 15), 16);
|
|
9
|
+
}
|
|
10
|
+
exports.default = version;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type * from './types.js';
|
|
2
|
+
export { default as MAX } from './max.js';
|
|
3
|
+
export { default as NIL } from './nil.js';
|
|
4
|
+
export { default as parse } from './parse.js';
|
|
5
|
+
export { default as stringify } from './stringify.js';
|
|
6
|
+
export { default as v1 } from './v1.js';
|
|
7
|
+
export { default as v1ToV6 } from './v1ToV6.js';
|
|
8
|
+
export { default as v3 } from './v3.js';
|
|
9
|
+
export { default as v4 } from './v4.js';
|
|
10
|
+
export { default as v5 } from './v5.js';
|
|
11
|
+
export { default as v6 } from './v6.js';
|
|
12
|
+
export { default as v6ToV1 } from './v6ToV1.js';
|
|
13
|
+
export { default as v7 } from './v7.js';
|
|
14
|
+
export { default as validate } from './validate.js';
|
|
15
|
+
export { default as version } from './version.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { default as MAX } from './max.js';
|
|
2
|
+
export { default as NIL } from './nil.js';
|
|
3
|
+
export { default as parse } from './parse.js';
|
|
4
|
+
export { default as stringify } from './stringify.js';
|
|
5
|
+
export { default as v1 } from './v1.js';
|
|
6
|
+
export { default as v1ToV6 } from './v1ToV6.js';
|
|
7
|
+
export { default as v3 } from './v3.js';
|
|
8
|
+
export { default as v4 } from './v4.js';
|
|
9
|
+
export { default as v5 } from './v5.js';
|
|
10
|
+
export { default as v6 } from './v6.js';
|
|
11
|
+
export { default as v6ToV1 } from './v6ToV1.js';
|
|
12
|
+
export { default as v7 } from './v7.js';
|
|
13
|
+
export { default as validate } from './validate.js';
|
|
14
|
+
export { default as version } from './version.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default 'ffffffff-ffff-ffff-ffff-ffffffffffff';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createHash } from 'crypto';
|
|
2
|
+
function md5(bytes) {
|
|
3
|
+
if (Array.isArray(bytes)) {
|
|
4
|
+
bytes = Buffer.from(bytes);
|
|
5
|
+
}
|
|
6
|
+
else if (typeof bytes === 'string') {
|
|
7
|
+
bytes = Buffer.from(bytes, 'utf8');
|
|
8
|
+
}
|
|
9
|
+
return createHash('md5').update(bytes).digest();
|
|
10
|
+
}
|
|
11
|
+
export default md5;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default '00000000-0000-0000-0000-000000000000';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import validate from './validate.js';
|
|
2
|
+
function parse(uuid) {
|
|
3
|
+
if (!validate(uuid)) {
|
|
4
|
+
throw TypeError('Invalid UUID');
|
|
5
|
+
}
|
|
6
|
+
let v;
|
|
7
|
+
return Uint8Array.of((v = parseInt(uuid.slice(0, 8), 16)) >>> 24, (v >>> 16) & 0xff, (v >>> 8) & 0xff, v & 0xff, (v = parseInt(uuid.slice(9, 13), 16)) >>> 8, v & 0xff, (v = parseInt(uuid.slice(14, 18), 16)) >>> 8, v & 0xff, (v = parseInt(uuid.slice(19, 23), 16)) >>> 8, v & 0xff, ((v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000) & 0xff, (v / 0x100000000) & 0xff, (v >>> 24) & 0xff, (v >>> 16) & 0xff, (v >>> 8) & 0xff, v & 0xff);
|
|
8
|
+
}
|
|
9
|
+
export default parse;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function rng(): Uint8Array;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { randomFillSync } from 'crypto';
|
|
2
|
+
const rnds8Pool = new Uint8Array(256);
|
|
3
|
+
let poolPtr = rnds8Pool.length;
|
|
4
|
+
export default function rng() {
|
|
5
|
+
if (poolPtr > rnds8Pool.length - 16) {
|
|
6
|
+
randomFillSync(rnds8Pool);
|
|
7
|
+
poolPtr = 0;
|
|
8
|
+
}
|
|
9
|
+
return rnds8Pool.slice(poolPtr, (poolPtr += 16));
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createHash } from 'crypto';
|
|
2
|
+
function sha1(bytes) {
|
|
3
|
+
if (Array.isArray(bytes)) {
|
|
4
|
+
bytes = Buffer.from(bytes);
|
|
5
|
+
}
|
|
6
|
+
else if (typeof bytes === 'string') {
|
|
7
|
+
bytes = Buffer.from(bytes, 'utf8');
|
|
8
|
+
}
|
|
9
|
+
return createHash('sha1').update(bytes).digest();
|
|
10
|
+
}
|
|
11
|
+
export default sha1;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import validate from './validate.js';
|
|
2
|
+
const byteToHex = [];
|
|
3
|
+
for (let i = 0; i < 256; ++i) {
|
|
4
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
5
|
+
}
|
|
6
|
+
export function unsafeStringify(arr, offset = 0) {
|
|
7
|
+
return (byteToHex[arr[offset + 0]] +
|
|
8
|
+
byteToHex[arr[offset + 1]] +
|
|
9
|
+
byteToHex[arr[offset + 2]] +
|
|
10
|
+
byteToHex[arr[offset + 3]] +
|
|
11
|
+
'-' +
|
|
12
|
+
byteToHex[arr[offset + 4]] +
|
|
13
|
+
byteToHex[arr[offset + 5]] +
|
|
14
|
+
'-' +
|
|
15
|
+
byteToHex[arr[offset + 6]] +
|
|
16
|
+
byteToHex[arr[offset + 7]] +
|
|
17
|
+
'-' +
|
|
18
|
+
byteToHex[arr[offset + 8]] +
|
|
19
|
+
byteToHex[arr[offset + 9]] +
|
|
20
|
+
'-' +
|
|
21
|
+
byteToHex[arr[offset + 10]] +
|
|
22
|
+
byteToHex[arr[offset + 11]] +
|
|
23
|
+
byteToHex[arr[offset + 12]] +
|
|
24
|
+
byteToHex[arr[offset + 13]] +
|
|
25
|
+
byteToHex[arr[offset + 14]] +
|
|
26
|
+
byteToHex[arr[offset + 15]]).toLowerCase();
|
|
27
|
+
}
|
|
28
|
+
function stringify(arr, offset = 0) {
|
|
29
|
+
const uuid = unsafeStringify(arr, offset);
|
|
30
|
+
if (!validate(uuid)) {
|
|
31
|
+
throw TypeError('Stringified UUID is invalid');
|
|
32
|
+
}
|
|
33
|
+
return uuid;
|
|
34
|
+
}
|
|
35
|
+
export default stringify;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type UUIDTypes<TBuf extends Uint8Array = Uint8Array> = string | TBuf;
|
|
2
|
+
export type Version1Options = {
|
|
3
|
+
node?: Uint8Array;
|
|
4
|
+
clockseq?: number;
|
|
5
|
+
random?: Uint8Array;
|
|
6
|
+
rng?: () => Uint8Array;
|
|
7
|
+
msecs?: number;
|
|
8
|
+
nsecs?: number;
|
|
9
|
+
_v6?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type Version4Options = {
|
|
12
|
+
random?: Uint8Array;
|
|
13
|
+
rng?: () => Uint8Array;
|
|
14
|
+
};
|
|
15
|
+
export type Version6Options = Version1Options;
|
|
16
|
+
export type Version7Options = {
|
|
17
|
+
random?: Uint8Array;
|
|
18
|
+
msecs?: number;
|
|
19
|
+
seq?: number;
|
|
20
|
+
rng?: () => Uint8Array;
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as assert from 'assert';
|
|
2
|
+
import v1 from './v1.js';
|
|
3
|
+
import v3 from './v3.js';
|
|
4
|
+
import v4 from './v4.js';
|
|
5
|
+
import v5 from './v5.js';
|
|
6
|
+
import v6 from './v6.js';
|
|
7
|
+
import v7 from './v7.js';
|
|
8
|
+
function usage() {
|
|
9
|
+
console.log('Usage:');
|
|
10
|
+
console.log(' uuid');
|
|
11
|
+
console.log(' uuid v1');
|
|
12
|
+
console.log(' uuid v3 <name> <namespace uuid>');
|
|
13
|
+
console.log(' uuid v4');
|
|
14
|
+
console.log(' uuid v5 <name> <namespace uuid>');
|
|
15
|
+
console.log(' uuid v6');
|
|
16
|
+
console.log(' uuid v7');
|
|
17
|
+
console.log(' uuid --help');
|
|
18
|
+
console.log('\nNote: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs defined by RFC9562');
|
|
19
|
+
}
|
|
20
|
+
const args = process.argv.slice(2);
|
|
21
|
+
if (args.indexOf('--help') >= 0) {
|
|
22
|
+
usage();
|
|
23
|
+
process.exit(0);
|
|
24
|
+
}
|
|
25
|
+
const version = args.shift() || 'v4';
|
|
26
|
+
switch (version) {
|
|
27
|
+
case 'v1':
|
|
28
|
+
console.log(v1());
|
|
29
|
+
break;
|
|
30
|
+
case 'v3': {
|
|
31
|
+
const name = args.shift();
|
|
32
|
+
let namespace = args.shift();
|
|
33
|
+
assert.ok(name != null, 'v3 name not specified');
|
|
34
|
+
assert.ok(namespace != null, 'v3 namespace not specified');
|
|
35
|
+
if (namespace === 'URL') {
|
|
36
|
+
namespace = v3.URL;
|
|
37
|
+
}
|
|
38
|
+
if (namespace === 'DNS') {
|
|
39
|
+
namespace = v3.DNS;
|
|
40
|
+
}
|
|
41
|
+
console.log(v3(name, namespace));
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case 'v4':
|
|
45
|
+
console.log(v4());
|
|
46
|
+
break;
|
|
47
|
+
case 'v5': {
|
|
48
|
+
const name = args.shift();
|
|
49
|
+
let namespace = args.shift();
|
|
50
|
+
assert.ok(name != null, 'v5 name not specified');
|
|
51
|
+
assert.ok(namespace != null, 'v5 namespace not specified');
|
|
52
|
+
if (namespace === 'URL') {
|
|
53
|
+
namespace = v5.URL;
|
|
54
|
+
}
|
|
55
|
+
if (namespace === 'DNS') {
|
|
56
|
+
namespace = v5.DNS;
|
|
57
|
+
}
|
|
58
|
+
console.log(v5(name, namespace));
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
case 'v6':
|
|
62
|
+
console.log(v6());
|
|
63
|
+
break;
|
|
64
|
+
case 'v7':
|
|
65
|
+
console.log(v7());
|
|
66
|
+
break;
|
|
67
|
+
default:
|
|
68
|
+
usage();
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Version1Options } from './types.js';
|
|
2
|
+
type V1State = {
|
|
3
|
+
node?: Uint8Array;
|
|
4
|
+
clockseq?: number;
|
|
5
|
+
msecs?: number;
|
|
6
|
+
nsecs?: number;
|
|
7
|
+
};
|
|
8
|
+
declare function v1(options?: Version1Options, buf?: undefined, offset?: number): string;
|
|
9
|
+
declare function v1<Buf extends Uint8Array = Uint8Array>(options: Version1Options | undefined, buf: Buf, offset?: number): Buf;
|
|
10
|
+
export declare function updateV1State(state: V1State, now: number, rnds: Uint8Array): V1State;
|
|
11
|
+
export default v1;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import rng from './rng.js';
|
|
2
|
+
import { unsafeStringify } from './stringify.js';
|
|
3
|
+
const _state = {};
|
|
4
|
+
function v1(options, buf, offset) {
|
|
5
|
+
let bytes;
|
|
6
|
+
const isV6 = options?._v6 ?? false;
|
|
7
|
+
if (options) {
|
|
8
|
+
const optionsKeys = Object.keys(options);
|
|
9
|
+
if (optionsKeys.length === 1 && optionsKeys[0] === '_v6') {
|
|
10
|
+
options = undefined;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (options) {
|
|
14
|
+
bytes = v1Bytes(options.random ?? options.rng?.() ?? rng(), options.msecs, options.nsecs, options.clockseq, options.node, buf, offset);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
const now = Date.now();
|
|
18
|
+
const rnds = rng();
|
|
19
|
+
updateV1State(_state, now, rnds);
|
|
20
|
+
bytes = v1Bytes(rnds, _state.msecs, _state.nsecs, isV6 ? undefined : _state.clockseq, isV6 ? undefined : _state.node, buf, offset);
|
|
21
|
+
}
|
|
22
|
+
return buf ?? unsafeStringify(bytes);
|
|
23
|
+
}
|
|
24
|
+
export function updateV1State(state, now, rnds) {
|
|
25
|
+
state.msecs ??= -Infinity;
|
|
26
|
+
state.nsecs ??= 0;
|
|
27
|
+
if (now === state.msecs) {
|
|
28
|
+
state.nsecs++;
|
|
29
|
+
if (state.nsecs >= 10000) {
|
|
30
|
+
state.node = undefined;
|
|
31
|
+
state.nsecs = 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else if (now > state.msecs) {
|
|
35
|
+
state.nsecs = 0;
|
|
36
|
+
}
|
|
37
|
+
else if (now < state.msecs) {
|
|
38
|
+
state.node = undefined;
|
|
39
|
+
}
|
|
40
|
+
if (!state.node) {
|
|
41
|
+
state.node = rnds.slice(10, 16);
|
|
42
|
+
state.node[0] |= 0x01;
|
|
43
|
+
state.clockseq = ((rnds[8] << 8) | rnds[9]) & 0x3fff;
|
|
44
|
+
}
|
|
45
|
+
state.msecs = now;
|
|
46
|
+
return state;
|
|
47
|
+
}
|
|
48
|
+
function v1Bytes(rnds, msecs, nsecs, clockseq, node, buf, offset = 0) {
|
|
49
|
+
if (rnds.length < 16) {
|
|
50
|
+
throw new Error('Random bytes length must be >= 16');
|
|
51
|
+
}
|
|
52
|
+
if (!buf) {
|
|
53
|
+
buf = new Uint8Array(16);
|
|
54
|
+
offset = 0;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
if (offset < 0 || offset + 16 > buf.length) {
|
|
58
|
+
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
msecs ??= Date.now();
|
|
62
|
+
nsecs ??= 0;
|
|
63
|
+
clockseq ??= ((rnds[8] << 8) | rnds[9]) & 0x3fff;
|
|
64
|
+
node ??= rnds.slice(10, 16);
|
|
65
|
+
msecs += 12219292800000;
|
|
66
|
+
const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
|
67
|
+
buf[offset++] = (tl >>> 24) & 0xff;
|
|
68
|
+
buf[offset++] = (tl >>> 16) & 0xff;
|
|
69
|
+
buf[offset++] = (tl >>> 8) & 0xff;
|
|
70
|
+
buf[offset++] = tl & 0xff;
|
|
71
|
+
const tmh = ((msecs / 0x100000000) * 10000) & 0xfffffff;
|
|
72
|
+
buf[offset++] = (tmh >>> 8) & 0xff;
|
|
73
|
+
buf[offset++] = tmh & 0xff;
|
|
74
|
+
buf[offset++] = ((tmh >>> 24) & 0xf) | 0x10;
|
|
75
|
+
buf[offset++] = (tmh >>> 16) & 0xff;
|
|
76
|
+
buf[offset++] = (clockseq >>> 8) | 0x80;
|
|
77
|
+
buf[offset++] = clockseq & 0xff;
|
|
78
|
+
for (let n = 0; n < 6; ++n) {
|
|
79
|
+
buf[offset++] = node[n];
|
|
80
|
+
}
|
|
81
|
+
return buf;
|
|
82
|
+
}
|
|
83
|
+
export default v1;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import parse from './parse.js';
|
|
2
|
+
import { unsafeStringify } from './stringify.js';
|
|
3
|
+
export default function v1ToV6(uuid) {
|
|
4
|
+
const v1Bytes = typeof uuid === 'string' ? parse(uuid) : uuid;
|
|
5
|
+
const v6Bytes = _v1ToV6(v1Bytes);
|
|
6
|
+
return typeof uuid === 'string' ? unsafeStringify(v6Bytes) : v6Bytes;
|
|
7
|
+
}
|
|
8
|
+
function _v1ToV6(v1Bytes) {
|
|
9
|
+
return Uint8Array.of(((v1Bytes[6] & 0x0f) << 4) | ((v1Bytes[7] >> 4) & 0x0f), ((v1Bytes[7] & 0x0f) << 4) | ((v1Bytes[4] & 0xf0) >> 4), ((v1Bytes[4] & 0x0f) << 4) | ((v1Bytes[5] & 0xf0) >> 4), ((v1Bytes[5] & 0x0f) << 4) | ((v1Bytes[0] & 0xf0) >> 4), ((v1Bytes[0] & 0x0f) << 4) | ((v1Bytes[1] & 0xf0) >> 4), ((v1Bytes[1] & 0x0f) << 4) | ((v1Bytes[2] & 0xf0) >> 4), 0x60 | (v1Bytes[2] & 0x0f), v1Bytes[3], v1Bytes[8], v1Bytes[9], v1Bytes[10], v1Bytes[11], v1Bytes[12], v1Bytes[13], v1Bytes[14], v1Bytes[15]);
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UUIDTypes } from './types.js';
|
|
2
|
+
export { DNS, URL } from './v35.js';
|
|
3
|
+
declare function v3(value: string | Uint8Array, namespace: UUIDTypes, buf?: undefined, offset?: number): string;
|
|
4
|
+
declare function v3<TBuf extends Uint8Array = Uint8Array>(value: string | Uint8Array, namespace: UUIDTypes, buf: TBuf, offset?: number): TBuf;
|
|
5
|
+
declare namespace v3 {
|
|
6
|
+
var DNS: string;
|
|
7
|
+
var URL: string;
|
|
8
|
+
}
|
|
9
|
+
export default v3;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import md5 from './md5.js';
|
|
2
|
+
import v35, { DNS, URL } from './v35.js';
|
|
3
|
+
export { DNS, URL } from './v35.js';
|
|
4
|
+
function v3(value, namespace, buf, offset) {
|
|
5
|
+
return v35(0x30, md5, value, namespace, buf, offset);
|
|
6
|
+
}
|
|
7
|
+
v3.DNS = DNS;
|
|
8
|
+
v3.URL = URL;
|
|
9
|
+
export default v3;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UUIDTypes } from './types.js';
|
|
2
|
+
export declare function stringToBytes(str: string): Uint8Array;
|
|
3
|
+
export declare const DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
|
|
4
|
+
export declare const URL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
|
|
5
|
+
type HashFunction = (bytes: Uint8Array) => Uint8Array;
|
|
6
|
+
export default function v35<TBuf extends Uint8Array = Uint8Array>(version: 0x30 | 0x50, hash: HashFunction, value: string | Uint8Array, namespace: UUIDTypes, buf?: TBuf, offset?: number): UUIDTypes<TBuf>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import parse from './parse.js';
|
|
2
|
+
import { unsafeStringify } from './stringify.js';
|
|
3
|
+
export function stringToBytes(str) {
|
|
4
|
+
str = unescape(encodeURIComponent(str));
|
|
5
|
+
const bytes = new Uint8Array(str.length);
|
|
6
|
+
for (let i = 0; i < str.length; ++i) {
|
|
7
|
+
bytes[i] = str.charCodeAt(i);
|
|
8
|
+
}
|
|
9
|
+
return bytes;
|
|
10
|
+
}
|
|
11
|
+
export const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
12
|
+
export const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
13
|
+
export default function v35(version, hash, value, namespace, buf, offset) {
|
|
14
|
+
const valueBytes = typeof value === 'string' ? stringToBytes(value) : value;
|
|
15
|
+
const namespaceBytes = typeof namespace === 'string' ? parse(namespace) : namespace;
|
|
16
|
+
if (typeof namespace === 'string') {
|
|
17
|
+
namespace = parse(namespace);
|
|
18
|
+
}
|
|
19
|
+
if (namespace?.length !== 16) {
|
|
20
|
+
throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
|
|
21
|
+
}
|
|
22
|
+
let bytes = new Uint8Array(16 + valueBytes.length);
|
|
23
|
+
bytes.set(namespaceBytes);
|
|
24
|
+
bytes.set(valueBytes, namespaceBytes.length);
|
|
25
|
+
bytes = hash(bytes);
|
|
26
|
+
bytes[6] = (bytes[6] & 0x0f) | version;
|
|
27
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
28
|
+
if (buf) {
|
|
29
|
+
offset = offset || 0;
|
|
30
|
+
for (let i = 0; i < 16; ++i) {
|
|
31
|
+
buf[offset + i] = bytes[i];
|
|
32
|
+
}
|
|
33
|
+
return buf;
|
|
34
|
+
}
|
|
35
|
+
return unsafeStringify(bytes);
|
|
36
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Version4Options } from './types.js';
|
|
2
|
+
declare function v4(options?: Version4Options, buf?: undefined, offset?: number): string;
|
|
3
|
+
declare function v4<TBuf extends Uint8Array = Uint8Array>(options: Version4Options | undefined, buf: TBuf, offset?: number): TBuf;
|
|
4
|
+
export default v4;
|