Skip to content

Commit 416d5ca

Browse files
feat(Geo) Construct: Phase 1 - Construct and APIs (#2958)
* adding output schemas * creating changeset * API changes * adding package and required files with partial implementation adding package and required files with partial implementation# * adding initial version of construct and API * updating API and exposed endpoints * adding output definition * split APi definition and outputs aspects defined * unit testing v1 and debugging * updating tsconfig * fixing some expressions * updating API from recent commits * removing all previous changesets * Revert "removing all previous changesets" This reverts commit e2af23b. * removing changeset files instead of directory * Revert "removing changeset files instead of directory" This reverts commit 93e024f. * removing changeset files * adding changeset * clean up * geo client-output bug fixed * updating API and fixing policy name duplication bug * adding changeset for changed packages and updated README * small fixes * bumping packages * regenerating package-lock with new cdk versions * updating packages and adding v1.5 schema * stepping back, reverting last commit * new package-lock * small fixes v3 * fixing unit test issues after fixes v3 * small fixes v4 * small fixes v5 * removing resource definitions from this PR and small fixes v6 * restore changesets * downgrading alpha location construct version * changing package lock * fixing double-stringify issue with backend outputs and update test cases * code cleanup * replacing changeset --------- Co-authored-by: sobolk <[email protected]>
1 parent 6e5be9b commit 416d5ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+4069
-0
lines changed

.changeset/quiet-oranges-march.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@aws-amplify/backend-output-schemas': patch
3+
'create-amplify': patch
4+
'@aws-amplify/client-config': patch
5+
'@aws-amplify/backend-geo': patch
6+
---
7+
8+
- Introduces a new backend-geo package that includes new constructs for geo resources
9+
- Unit test cases for the functionality of these constructs and resources are provided
10+
- Client configurations and backend output storage strategies updated

.eslint_dictionary.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@
7676
"frontmatter",
7777
"fullname",
7878
"func",
79+
"geo",
7980
"geofence",
81+
"geofences",
8082
"getaddrinfo",
8183
"gitignore",
8284
"gitignored",
@@ -213,6 +215,7 @@
213215
"userpool",
214216
"utf",
215217
"utimes",
218+
"validators",
216219
"verdaccio",
217220
"verifier",
218221
"versioned",

package-lock.json

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/backend-geo/.npmignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Be very careful editing this file. It is crafted to work around [this issue](https://github.com/npm/npm/issues/4479)
2+
3+
# First ignore everything
4+
**/*
5+
6+
# Then add back in transpiled js and ts declaration files
7+
!lib/**/*.js
8+
!lib/**/*.d.ts
9+
10+
# Then ignore test js and ts declaration files
11+
*.test.js
12+
*.test.d.ts
13+
14+
# This leaves us with including only js and ts declaration files of functional code

packages/backend-geo/API.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
## API Report File for "@aws-amplify/backend-geo"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
import { AmplifyUserErrorOptions } from '@aws-amplify/platform-core';
8+
import { BackendOutputStorageStrategy } from '@aws-amplify/plugin-types';
9+
import { CfnGeofenceCollection } from 'aws-cdk-lib/aws-location';
10+
import { ConstructFactory } from '@aws-amplify/plugin-types';
11+
import { ConstructFactoryGetInstanceProps } from '@aws-amplify/plugin-types';
12+
import { GeoOutput } from '@aws-amplify/backend-output-schemas';
13+
import * as kms from 'aws-cdk-lib/aws-kms';
14+
import { ResourceAccessAcceptor } from '@aws-amplify/plugin-types';
15+
import { ResourceProvider } from '@aws-amplify/plugin-types';
16+
import { StackProvider } from '@aws-amplify/plugin-types';
17+
18+
// @public
19+
export type AmplifyCollectionFactoryProps = Omit<AmplifyCollectionProps, 'outputStorageStrategy'> & {
20+
access?: GeoAccessGenerator;
21+
};
22+
23+
// @public (undocumented)
24+
export type AmplifyCollectionProps = {
25+
name: string;
26+
description?: string;
27+
kmsKey?: kms.IKey;
28+
isDefault?: boolean;
29+
outputStorageStrategy?: BackendOutputStorageStrategy<GeoOutput>;
30+
};
31+
32+
// @public
33+
export type AmplifyMapFactoryProps = Omit<AmplifyMapProps, 'outputStorageStrategy'> & {
34+
access?: GeoAccessGenerator;
35+
};
36+
37+
// @public (undocumented)
38+
export type AmplifyMapProps = {
39+
name: string;
40+
outputStorageStrategy?: BackendOutputStorageStrategy<GeoOutput>;
41+
};
42+
43+
// @public
44+
export type AmplifyPlaceFactoryProps = Omit<AmplifyPlaceProps, 'outputStorageStrategy'> & {
45+
access?: GeoAccessGenerator;
46+
};
47+
48+
// @public (undocumented)
49+
export type AmplifyPlaceProps = {
50+
name: string;
51+
outputStorageStrategy?: BackendOutputStorageStrategy<GeoOutput>;
52+
};
53+
54+
// @public
55+
export type CollectionResources = {
56+
cfnResources: {
57+
cfnCollection: CfnGeofenceCollection;
58+
};
59+
};
60+
61+
// @public
62+
export const defineCollection: (props: AmplifyCollectionFactoryProps) => ConstructFactory<ResourceProvider<CollectionResources> & StackProvider>;
63+
64+
// @public
65+
export const defineMap: (props: AmplifyMapFactoryProps) => ConstructFactory<ResourceProvider<object> & StackProvider>;
66+
67+
// @public
68+
export const definePlace: (props: AmplifyPlaceFactoryProps) => ConstructFactory<ResourceProvider<object> & StackProvider>;
69+
70+
// @public (undocumented)
71+
export type GeoAccessBuilder = {
72+
authenticated: GeoActionBuilder;
73+
guest: GeoActionBuilder;
74+
groups: (groupNames: string[]) => GeoActionBuilder;
75+
};
76+
77+
// @public (undocumented)
78+
export type GeoAccessDefinition = {
79+
getAccessAcceptors: ((getInstanceProps: ConstructFactoryGetInstanceProps) => ResourceAccessAcceptor)[];
80+
actions: string[];
81+
uniqueDefinitionValidators: {
82+
uniqueRoleToken: string;
83+
validationErrorOptions: AmplifyUserErrorOptions;
84+
}[];
85+
};
86+
87+
// @public (undocumented)
88+
export type GeoAccessGenerator = (allow: GeoAccessBuilder) => GeoAccessDefinition[];
89+
90+
// @public (undocumented)
91+
export type GeoActionBuilder = {
92+
to: (actions: string[]) => GeoAccessDefinition;
93+
};
94+
95+
// @public (undocumented)
96+
export type GeoResourceType = 'map' | 'place' | 'collection';
97+
98+
// (No @packageDocumentation comment for this package)
99+
100+
```

packages/backend-geo/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Description
2+
3+
This package defines an L3 construct for the Amplify Geo category. It includes the L3 CDK constructs and resources along with 3 exposed endpoints `defineMap`, `definePlace`, and `defineCollection` to provision those resources.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "../../api-extractor.base.json"
3+
}

packages/backend-geo/package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "@aws-amplify/backend-geo",
3+
"version": "0.1.0",
4+
"type": "module",
5+
"publishConfig": {
6+
"access": "public"
7+
},
8+
"exports": {
9+
".": {
10+
"types": "./lib/index.d.ts",
11+
"import": "./lib/index.js",
12+
"require": "./lib/index.js"
13+
}
14+
},
15+
"main": "lib/index.js",
16+
"types": "lib/index.d.ts",
17+
"scripts": {
18+
"update:api": "api-extractor run --local"
19+
},
20+
"license": "Apache-2.0",
21+
"peerDependencies": {
22+
"aws-cdk-lib": "^2.189.1",
23+
"constructs": "^10.0.0"
24+
},
25+
"dependencies": {
26+
"@aws-amplify/backend-output-schemas": "^1.7.0",
27+
"@aws-amplify/backend-output-storage": "^1.3.1",
28+
"@aws-amplify/platform-core": "^1.10.0",
29+
"@aws-cdk/aws-location-alpha": "^2.189.1-alpha.0"
30+
}
31+
}

0 commit comments

Comments
 (0)